package game;
import java.awt.*;

import javax.swing.ImageIcon;

public abstract class FlyingObj {

        private boolean visible;
        private Image image;
        protected double x;
        protected double y;
        protected double dx, dy;
        protected int speed;
        public int hp; //hit points
        public int width, height;

        public FlyingObj() {
            visible = true;
        }
        
        public void die() {
            visible = false;
        }

        public boolean isVisible() {
            return visible;
        }

        protected void setVisible(boolean visible) {
            this.visible = visible;
        }

        public void setImage(Image image) {
            this.image = image;
        }
        
        public void setImage(String addr) //overload
        {
    		ImageIcon ii = new ImageIcon(this.getClass().getResource(addr));
            width = ii.getImage().getWidth(null); 
            height = ii.getImage().getHeight(null);
            setImage(ii.getImage());
        }

        public Image getImage() {
            return image;
        }
        
        public void setX(double x) {
            this.x = x;
        }

        public void setY(double y) {
            this.y = y;
        }
        public int getY() {
            return (int)y;
        }

        public int getX() {
            return (int)x;
        }
}